
// 热门新闻
function getNewsList(pageSize) {
    var loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_news/list',
        http_type: 'POST',
        datas: {
            "page_size": pageSize,
            "page": "1"
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            let NEWSHTML = ''
            console.log('--------------->>>>>热门新闻', response.data.data)
            $.each(response.data.data, function (index, value) {
                NEWSHTML += ` <div class="trending_news_content_item">
                <img src="${value.avatar}" alt="">
                <div>
                    <p>${value.title}</p>
                    <span>${value.createtime}</span>
                </div>
            </div>
            `
            });
            $('.trending_news_content').html(NEWSHTML)

        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}
// 文章列表
function getArticleList(pageSize) {
    var loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_article/list',
        http_type: 'POST',
        datas: {
            "page_size": pageSize,
            "page": "1"
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            let strHTML1 = ''
            console.log('--------------->>>>>文章list', response.data.data)
            $.each(response.data.data, function (index, value) {
                strHTML1 += `
                <div class="hot_article_content_item">
                    <img src="${value.avatar}" alt="">
                    <p>${value.title}</p>
                    <div>邀您${value.createtime}参与</div>
                </div>`
            });
            $('.hot_article_content').html(strHTML1)

        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}

// 企业列表
function getCompanyList(pageSize) {
    var loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_company/list',
        http_type: 'POST',
        datas: {
            "page_size": pageSize,
            "page": "1"
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            let CompanyHTML = ''
            console.log('--------------->>>>>企业列表', response.data.data)
            $.each(response.data.data, function (index, value) {
                CompanyHTML += `
                <div class="latest_release_content_item">
                <img src="${value.avatar}" alt="">
                <span>${value.title}</span>
            </div>`
            });
            $('.latest_release_content').html(CompanyHTML)

        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}
// 会议动态列表
function getMetingList(pageSize) {
    const loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_conference/list',
        http_type: 'POST',
        datas: {
            "page": 1,
            "page_size": pageSize
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            console.log('--------------->>>>>会议动态列表', response.data.data)

            $(".meeting_dynamic_content").children(".meeting_dynamic_content_item").remove();
            for (let i = 0; i < response.data.data.length; i++) {
                let meeting_dynamic_content_item = $("<div class='meeting_dynamic_content_item'></div>")
                let div_1 = $("<div></div>")
                $(div_1).css("background-image", 'url(' + response.data.data[i].avatar + ')');
                let div_1_span = $("<span></span>")
                $(div_1_span).text('邀您' + response.data.data[i].createtime.substring(0, 9) + '参加')
                $(div_1).append(div_1_span)
                let p = $("<p></p>")
                $(p).text(response.data.data[i].title)
                let span_1 = $("<span></span>")
                $(span_1).text('主办方：' + response.data.data[i].sponsor ? response.data.data[i].sponsor : '暂无')
                let div_2 = $("<div></div>")
                let div_2_img = $("<img src='../../icons/icon_location.png'/>")
                let div_2_span_1 = $("<span></span>")
                $(div_2_span_1).text(response.data.data[i].region_text ? response.data.data[i].region_text : '暂无')
                let div_2_span_2 = $("<span></span>")
                $(div_2_span_2).text(response.data.data[i].type ? response.data.data[i].type : '暂无')
                $(div_2).append(div_2_img)
                $(div_2).append(div_2_span_1)
                $(div_2).append(div_2_span_2)
                $(meeting_dynamic_content_item).append(div_1)
                $(meeting_dynamic_content_item).append(p)
                $(meeting_dynamic_content_item).append(span_1)
                $(meeting_dynamic_content_item).append(div_2)
                $(".meeting_dynamic_content_refresh").before(meeting_dynamic_content_item)
            }
            return response.data.total
        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}
// 展会列表
function getExhibitionList(pageSize) {
    var loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_exhibition/list',
        http_type: 'POST',
        datas: {
            "page_size": pageSize,
            "page": "1"
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            // let CompanyHTML = ''
            console.log('--------------->>>>>展会列表', response.data.data)
          
            // $.each(response.data.data, function (index, value) {
            //     CompanyHTML += `
            //     <div class="exhibition_dynamic_content_item">
            //     <span>${value.title}</span>
            //     <div><div>
            //     <img src="../../icons/icon_location.png">
            //     <span>暂无</span><span>暂无</span></div>
            //     <span>2024-07-2</span></div></div>
            //     `
            // });
            // $('.exhibition_dynamic_content_list').html(CompanyHTML)
            $(".exhibition_dynamic_content_list") .html ('');
            for (let i = 0; i < response.data.data.length; i++) {
                let meeting_dynamic_content_item = $("<div class='meeting_dynamic_content_item'></div>")
                let div_1 = $("<div></div>")
                $(div_1).css("background-image", 'url(' + response.data.data[i].avatar + ')');
                let div_1_span = $("<span></span>")
                $(div_1_span).text('邀您' + response.data.data[i].createtime.substring(0, 9) + '参加')
                $(div_1).append(div_1_span)
                let p = $("<p></p>")
                $(p).text(response.data.data[i].title)
                let span_1 = $("<span></span>")
                $(span_1).text('主办方：' + response.data.data[i].sponsor ? response.data.data[i].sponsor : '暂无')
                let div_2 = $("<div></div>")
                let div_2_img = $("<img src='../../icons/icon_location.png'/>")
                let div_2_span_1 = $("<span></span>")
                $(div_2_span_1).text(response.data.data[i].region_text ? response.data.data[i].region_text : '暂无')
                let div_2_span_2 = $("<span></span>")
                $(div_2_span_2).text(response.data.data[i].type ? response.data.data[i].type : '暂无')
                $(div_2).append(div_2_img)
                $(div_2).append(div_2_span_1)
                $(div_2).append(div_2_span_2)
                $(meeting_dynamic_content_item).append(div_1)
                $(meeting_dynamic_content_item).append(p)
                $(meeting_dynamic_content_item).append(span_1)
                $(meeting_dynamic_content_item).append(div_2)
                $(".exhibition_dynamic_content_list").before(meeting_dynamic_content_item)
            }
            return response.data.total

        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}


// 论坛汇聚
function getForumList(pageSize) {
    var loadIndex = layer.load(2);
    let datas = {
        url: '/api/forum.forum/list',
        http_type: 'POST',
        datas: {
            "page_size": pageSize,
            "page": "1",
            "forum_group_id": "1",

        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            let CompanyHTML1 = ''
            console.log('--------------->>>>>论坛汇聚', response.data.data)
            $.each(response.data.data, function (index, value) {
                CompanyHTML1 += `
                <div class="forum_content_item">
                        <div class="forum_content_item_left">
                            <span>中国机械论坛</span>
                            <span>1000人</span>
                            <div>进入论坛</div>
                        </div>
                        <img src="../../icons/icon_forum.png" alt="">
                    </div>`
            });
            $('.forum_content_luntan').html(CompanyHTML1)

        } else {
            layer.alert(response.msg, { title: '温馨提示' });
        }
    });
}
 
getMetingList(4) // 会议动态列表  
getExhibitionList(4) //展会列表
getNewsList(4)//热门新闻
getArticleList(3)//文章列表
getCompanyList(10)//企业列表
getForumList(10)//论坛汇聚

 
